package com.navinfo.tripanalysis.common.arithmetic.common;

import lombok.Data;

/**
 * 公共的统计变量 <br/>
 * 里程、油耗、时长、次数
 */
@Data
public class VarNumberStatistics extends VarNumber {

    /**
     * 转速
     */
    private int rotation;
    /**
     * 油门开度
     */
    private double gasOpenPercent;
    /**
     * 带档滑行里程
     */
    private double gearMileage;

    /**
     * 带档滑行缓存里程，带档滑行开始到结束时间超过3s，累加到带档滑行里程
     */
    private double gearInMileage;

    /**
     * 累加转速
     * @param rotation 单位: rpm
     */
    public void addRotation(int rotation){
        this.rotation += rotation;
    }

    /**
     * 累加油门开度
     * @param gasOpenPercent 单位: %
     */
    public void addGasOpenPercent(double gasOpenPercent){
        this.gasOpenPercent += gasOpenPercent;
    }

    /**
     * 累加带档滑行里程,将缓存带档里程清0
     */
    public void addGearMileage(){
        this.gearMileage += this.gearInMileage;
        //this.gearInMileage = 0;
    }

    /**
     * 清空缓存带档里程
     */
    public void clearGearInMileage(){
        this.gearInMileage = 0;
    }

    /**
     * 累加缓存带档里程
     * @param gearInMileage
     */
    public void addGearInMileage(double gearInMileage){
        this.gearInMileage += gearInMileage;
    }


}
